export {};

// 定义个type 获取返回值的类型, 与参数类型无关。
type MyReturnType<T> = T extends (...args: any[]) => infer R ? R : never;

type r1 = MyReturnType<(value: number) => string>; //string
type r2 = MyReturnType<(y:number) => 123>; // 123
type r3 = MyReturnType<() => Promise<boolean>> // Promise<boolean
type r4 = MyReturnType<() => () => 'foo'> // () => 'foo'